#!/usr/bin/env zx

const appName = 'js-sapi'
let log

await $`rm -rf pnpm-lock.yaml`
await $`rm -rf ./data/.output`
echo`正在拉取最新的代码`
await $`git pull`
echo`拉取完毕`

echo`开始编译打包`
await $`pnpm i && pnpm build`
echo`打包完成`

echo`重新启动${appName}微服务`
log = await $`podman-compose down`
echo`${log}`

await $`mv .output ./data/`

log = await $`podman-compose up -d`
echo`${log}`
echo`${appName}微服务重启完成`
